package com.prs.crm.domain.cdxh;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;
import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.sale.ReturnsDetail;

/**
 * 新发生计划Bean
 * 
 * @author 兰小刚
 * @version 创建时间：2010-12-02 下午13:09:28 类说明
 */
@Entity
@Table(name = "cdxh_NewPlanOrder")
public class NewPlanOrder extends BaseEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	/**
	 * 生产计划编号
	 */
	private String newProCode;
	/**
	 * 登记人
	 */
	private String newRegister;

	/**
	 * 供货时间
	 */
	private Date suppliesTime;
	/**
	 * 订单状态
	 */
	private String states;

	/**
	 * 新发生计划明细
	 */
	@OneToMany(mappedBy = "newPlanOrder")
	@Cascade({ org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<NewPlanOrderDetail> details;

	/**
	 * 总的价格
	 */
	private Double allPrice;

	/**
	 * 是否急单
	 */
	private String rushOrder;
	/**
	 * 备注
	 */
	@Lob
	private String newRemark;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Date getSuppliesTime() {
		return suppliesTime;
	}

	public void setSuppliesTime(Date suppliesTime) {
		this.suppliesTime = suppliesTime;
	}

	public Set<NewPlanOrderDetail> getDetails() {
		return details;
	}

	public void setDetails(Set<NewPlanOrderDetail> details) {
		this.details = details;
	}

	public String getNewRemark() {
		return newRemark;
	}

	public void setNewRemark(String newRemark) {
		this.newRemark = newRemark;
	}

	public Double getAllPrice() {
		return allPrice;
	}

	public void setAllPrice(Double allPrice) {
		this.allPrice = allPrice;
	}

	public String getNewRegister() {
		return newRegister;
	}

	public void setNewRegister(String newRegister) {
		this.newRegister = newRegister;
	}

	public void addDetail(NewPlanOrderDetail detail) {
		if (details == null)
			details = new HashSet<NewPlanOrderDetail>();
		detail.setNewPlanOrder(this);
		details.add(detail);
	}

	public String getNewProCode() {
		return newProCode;
	}

	public void setNewProCode(String newProCode) {
		this.newProCode = newProCode;
	}

	public String getRushOrder() {
		return rushOrder;
	}

	public void setRushOrder(String rushOrder) {
		this.rushOrder = rushOrder;
	}

	public String getStates() {
		return states;
	}

	public void setStates(String states) {
		this.states = states;
	}

}
